15:00
https://rss-quarto.jumpingrivers.training/welcome/
Password: avocado-lime
Background in Astrophysics.
Data Scientist @ Jumping Rivers:
Python support for various clients.
Teach courses in Python, SQL and ML.
Hobbies include hiking and travelling.
↗ jumpingrivers.com 𝕏 @jumping_uk
Quarto is a tool created by Posit (formerly RStudio).
R Markdown isn’t going anywhere, but…
Quarto has better multi-language support.
More user-friendly.
Better control of the output layouts.
There is an R package library(quarto).
New features will be added to Quarto.
File > New File > Quarto Document
Set title and author
Click Create
Save and click Render
YAML: Yet Another Markup Language
Then click the Render button.
Or type into a Quarto document:
Use the Visual editor - click Insert –> Figure/Image
Or type into a Quarto document:
File > New File > Quarto Document.
Set title and author.
Click Create.
Save and click Render.
Add the text from task1.txt.
Add a link to the Duke Lemur Center https://lemur.duke.edu/.
Add the image of the Mongoose Lemur.
15:00
… and lemurs…
You can load in your data using R:
If we’re just loading in packages, perhaps we should collapse the code…
… do some data wrangling, and print the output as a table…
| sex | weight_g | age_at_wt_mo |
|---|---|---|
| M | 1086 | 125.82 |
| M | 1190 | 129.93 |
| F | 947 | 131.11 |
| F | 1174 | 135.42 |
| M | 899 | 100.64 |
| M | 917 | 101.06 |
…or include some exploratory plots!
```{r}
#| message: false
#| output-location: slide
#| fig-cap: "Age vs weight of lemurs"
#| fig-alt: "Scatter plot showing positive relationship between lemur age and weight split by sex"
#| out-width: 150%
ggplot(data = df,
mapping = aes(x = age_at_wt_mo,
y = weight_g,
colour = sex)) +
geom_point(alpha = 0.1) +
geom_smooth(method = "lm") +
labs(title = "Weight of lemurs",
x = "Age (months)",
y = "Weight (g)")
```We can also include code inline, rather than as a separate chunk.
The number of observations is `r num_obs`.
The number of observations is 82609.
Add a code block to your document to load the data and some libraries. Use the code in task-2.R.
Set the code chunk options to hide the code and messages.
Add a second code block to make a scatter plot (use the code given or make your own).
Add a caption to the plot with the fig-cap code chunk option.
Add a final code chunk to find the average weight, and show the code.
15:00
Let’s explore some more use cases!
Great way to demonstrate code:
Engaging format for teaching!
Easy to add elements like progress bar, slide numbering, etc.
Nice animations.
Flexible CSS styling that can be shared.
LaTeX backend for PDF documents.
Correctly formatted journal articles in 30 seconds? Try quarto-journals.
E.g. for the Journal of Statistical Software article:
More journal templates: github.com/mcanouil/awesome-quarto#journals.
Add parameters to your document using the YAML header:
Access these parameters with params$species
Can update from the command line without the need for manual changes!
Everything we’ve shown here can also be done in Python!
Fence code cells with {python} instead of {r}.
VS Code and Jupyter Lab are both supported by Quarto.
Inline code and parameterised reporting is handled differently in Python.
See Python Quarto docs for details.
It’s easy to share your documents!
Quarto Pub is free to use and specifically designed for Quarto content.
GitHub pages (like this presentation).
Posit Connect
Netlify
Jumping Rivers